
#include "Point.h"

Point::Point():x(0),y(0){};

Point::Point(int x1, int y1):x(x1),y(y1){}

Point::~Point(){

}

int Point::getX() const{
	return x;
}

int Point::getY() const{
	return y;
}

void Point::setX(int x1){
	x = x1;
}

void Point::setY(int y1){
	y = y1;
}
		

Point Point::operator =(const Point &p){
	x = p.getX();
	y = p.getY();

	return *this;
}


Point Point::operator +(const Point &p){
	Point newPoint;
	newPoint.setX(x+p.getX());
	newPoint.setY(y+p.getY());
	return newPoint;
}

Point Point::operator -(const Point &p){
	Point newPoint;
	newPoint.setX(x-p.getX());
	newPoint.setY(y-p.getY());
	return newPoint;
}

bool Point::operator ==(const Point &p) const{
	return ((p.getX() == x) && (p.getY() == y));
}

Point::Point(const Point &p):x(p.x),y(p.y){
}

double Point::distance(const Point &p2) const{

	double dy = p2.getY() - y;
	double dx = p2.getX() - x;

	double h= sqrt(pow(dy,2) + pow (dx,2));

	return h;
}
